package org.xxx.epms.models.epms.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.xxx.epms.common.api.CommonPage;
import org.xxx.epms.common.api.CommonResult;
import org.xxx.epms.models.epms.dto.AqiFeedbackParam;
import org.xxx.epms.models.epms.dto.InspectorParam;
import org.xxx.epms.models.epms.model.AqiFeedback;
import org.xxx.epms.models.epms.model.Inspector;
import org.xxx.epms.models.epms.service.InspectorService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lb
 * @since 2024-06-08
 */
@RestController
@RequestMapping("/epms/inspector")
public class InspectorController {

    @Autowired
    private InspectorService inspectorService;

    //获取反馈列表总页数
    @RequestMapping(value = "/getInspectorListTotalPage",method = RequestMethod.POST )
    @ApiOperation(value = "获取网格员列表总页数", notes = "获取网格员列表总页数")
    public CommonResult<Integer> getFeedbackListTotalPage(@RequestBody InspectorParam inspectorParam,
                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
        int totalPage = inspectorService.getInspectorListTotalPage(inspectorParam, pageSize);
        return CommonResult.success(totalPage);
    };

    //分页获取反馈列表
    @RequestMapping(value = "/getInspectorList",method = RequestMethod.POST )
    @ApiOperation(value = "分页获取网格员列表", notes = "分页获取网格员列表")
    public CommonResult<CommonPage<Inspector>> getFeedbackList(@RequestBody InspectorParam inspectorParam,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){
        Page<Inspector> page = inspectorService.getInspectorList(inspectorParam, pageNum, pageSize);
        return CommonResult.success(CommonPage.restPage(page));
    };
}

